<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>继承</title>
</head>
<body>
<script>
    //组合继承，可以使用元素与方法
    function Animal(weight) {
        this.weight = weight;
    }
    Animal.prototype.eat= function () {
        console.log("just est something");
    };
    function Dog(weight,color) {
        Animal.call(this,weight);//可以继承父类的属性
        this.color = color;
    }
    Dog.prototype = new Animal();//可以使用父类的方法
    Dog.prototype.bite= function () {
        console.log('wang,wang,wang');
    };
    function Hasiki(weight,color,sex) {
        Dog.call(this,weight,color);
        this.sex = sex;
    }
    Hasiki.prototype = new Dog();
    Hasiki.prototype.joy=function () {
        console.log('I am so happy');
    };

    var ha = new Hasiki("20KG","black","公");
    console.log(ha.weight,ha.sex);
    ha.eat();
    ha.bite();
    ha.joy();
</script>
</body>
</html>